#include<iostream>
using namespace std;

int main(int argc, char const *argv[])
{
    int boyNum=0,girlNum=0;
    string s;
    getline(cin,s);
    for (int i = 0; i < s.size(); i++)
    {
        if(s[i]=='b'){
            boyNum++;
            if(s[i+1]=='o'){
                i++;
                if(s[i+1]=='y')i++;
            }
        }
        else if(s[i]=='o'){
            boyNum++;
            if(s[i+1]=='y')i++;
        }
        else if(s[i]=='y'){
            boyNum++;
        }
        else if(s[i]=='g'){
            girlNum++;
            if(s[i+1]=='i'){
                i++;
                if(s[i+1]=='r'){
                    i++;
                    if(s[i+1]=='l')i++;
                }
            }
        }
        else if(s[i]=='i'){
            girlNum++;
            if(s[i+1]=='r'){
                i++;
                if(s[i+1]=='l')i++;
            }
        }
        else if(s[i]=='r'){
            girlNum++;
            if(s[i+1]=='l')i++;
        }
        else if(s[i]=='l'){
            girlNum++;
        }
    }
    cout<<boyNum<<endl<<girlNum;
    return 0;
}
